Skip to content

fix: release stream ids on request setup failure - #1008

Merged
dkropachev merged 1 commit into
scylladb:scylla-4.xfrom
dkropachev:dk/1002-release-acquired-stream-id
Oct 20, 2026
Merged

dkropachev merged 1 commit into
scylladb:scylla-4.xfrom
dkropachev:dk/1002-release-acquired-stream-id

Conversation

@dkropachev

Copy link
Copy Markdown

Summary

  • release a concrete stream ID when request frame creation fails
  • release the ID when callback registration rejects the request
  • preserve ownership after successful in-flight registration
  • cover both failure windows with stateful stream-ID regression tests

Fixes #1002.

Tests

  • JAVA_HOME=.../11.0.29-tem mvn -pl core -am -DskipITs -Dtest=InFlightHandlerTest -Dsurefire.failIfNoSpecifiedTests=false test

@coderabbitai

coderabbitai Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: QUIET
  • Plan: Essentials
  • Run ID: 8577ddc8-f251-4074-9769-438f1addc224
📥 Commits

Reviewing files that changed from the base of the PR and between 60607b0 and c2df2e2.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: QUIET
  • Plan: Essentials
  • Run ID: bed4ac00-3eff-468e-b622-f74bc9833ff4
📥 Commits

Reviewing files that changed from the base of the PR and between b2a8030 and 60607b0.

📒 Files selected for processing: 2
  • core/src/main/java/com/datastax/oss/driver/internal/core/channel/InFlightHandler.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/channel/InFlightHandlerTest.java

Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

📝 Walkthrough

InFlightHandler.write now releases an acquired stream ID if frame creation or callback registration fails before a callback owns the ID. Duplicate in-flight registration still fails without releasing the existing callback’s ID. Tests cover these cases and ID reuse.

Suggested reviewers: olim7t

Priority: ➖ Normal

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 60607

This change releases stream IDs when a request write fails before a callback owns the ID, so repeated failures no longer reduce connection capacity. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: releasing stream IDs when request setup fails.
Description check Passed The description directly matches the changeset and states the failure cases, ownership behavior, regression tests, and validation command.
Linked Issues check Passed Issue #1002 requires release of each concrete stream ID after acquisition when frame creation or callback registration fails. InFlightHandler.write releases the ID in finally when no callback owns…
Out of Scope Changes check Passed The changes are limited to InFlightHandler cleanup logic and focused InFlightHandlerTest regression coverage. The implementation and tests directly support issue #1002.
Full details: Linked Issues check

Explanation

Issue #1002 requires release of each concrete stream ID after acquisition when frame creation or callback registration fails. InFlightHandler.write releases the ID in finally when no callback owns it. It preserves the existing callback ownership on duplicate registration. The added tests cover frame failure, registration failure, ID reuse, and single release of the original request.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@dkropachev
dkropachev force-pushed the dk/1002-release-acquired-stream-id branch from c11ba9b to 7946c1e Compare October 19, 2026 22:24
@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.86%. Comparing base (b2a8030) to head (c2df2e2).

Additional details and impacted files
@@               Coverage Diff                @@
##             scylla-4.x    #1008      +/-   ##
================================================
+ Coverage         84.82%   84.86%   +0.03%     
- Complexity         8629     8635       +6     
================================================
  Files               848      848              
  Lines             31033    31038       +5     
  Branches           4281     4282       +1     
================================================
+ Hits              26323    26339      +16     
+ Misses             4710     4699      -11     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dkropachev
dkropachev marked this pull request as ready for review October 19, 2026 23:26
@qodo-scylladb

qodo-scylladb Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Great, no issues found!

Qodo reviewed your code and found no material issues that require review
Tip of the day
💡 Did you know, you can import rules and skills only from the repositories your team follows

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗


Powered by Qodo

@dkropachev

Copy link
Copy Markdown
Author

In reply to

Write docstrings for the functions missing them to satisfy the coverage threshold.

Leaving these methods unchanged. The repository Javadoc guidance makes documentation optional for internal packages and does not require every method to be documented. This PR changes internal code and tests; the ownership comments and regression-test names describe the behavior.

An acquired stream ID has consumed its reservation before frame creation
and callback registration can fail. Release the concrete ID until a
callback owns it, while preserving IDs owned by an existing callback.

Cover frame creation and registration failures, verify reuse of the
released ID, and preserve the original request and response lifecycle.

Fixes scylladb#1002
@dkropachev
dkropachev force-pushed the dk/1002-release-acquired-stream-id branch from 60607b0 to c2df2e2 Compare October 19, 2026 23:35
@dkropachev
dkropachev requested a review from nikagra October 20, 2026 03:06
@dkropachev dkropachev self-assigned this Oct 20, 2026
@dkropachev
dkropachev merged commit c6d58b4 into scylladb:scylla-4.x Oct 20, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4.x: Stream ID can leak when InFlightHandler fails after acquisition

2 participants